/**
 * 
 */
package jmine.tec.report.cell.impl;

import java.io.Serializable;
import java.text.DateFormat;
import java.text.NumberFormat;
import java.util.Arrays;
import java.util.Date;

import jmine.tec.report.cell.DataCell;

/**
 * {@link DataCell} for reporting errors
 * 
 * @author takeshi
 */
public final class ErrorDataCell implements DataCell, Serializable {

    /**
     * 
     */
    private static final long serialVersionUID = 599842168436407273L;

    private final String errorCode;

    private final Object[] arguments;

    /**
     * @param errorCode the error code
     * @param arguments the arguments
     */
    public ErrorDataCell(final String errorCode, final Object... arguments) {
        super();
        this.errorCode = errorCode;
        final int size = arguments.length;
        this.arguments = new Object[size];
        if (size > 0) {
            System.arraycopy(arguments, 0, this.arguments, 0, size);
        }
    }

    /**
     * @return {@link Date}
     * @see br.com.maps.util.report.cell.DataCell#toDate()
     */
    public Date toDate() {
        return null;
    }

    /**
     * @return {@link Double}
     * @see br.com.maps.util.report.cell.DataCell#toDouble()
     */
    public Double toDouble() {
        return null;
    }

    /**
     * @param dateFormat the {@link DateFormat}
     * @param doubleFormat the {@link NumberFormat}
     * @param currencyFormat the {@link NumberFormat}
     * @return String
     * @see br.com.maps.util.report.cell.DataCell#toString(java.text.DateFormat, java.text.NumberFormat, java.text.NumberFormat)
     */
    public String toString(final DateFormat dateFormat, final NumberFormat doubleFormat,
            final NumberFormat currencyFormat) {
        return this.toString();
    }

    /**
     * @param o the other dataCell
     * @return int
     * @see java.lang.Comparable#compareTo(java.lang.Object)
     */
    public int compareTo(final DataCell o) {
        return this.toString().compareTo(o.toString());
    }

    /**
     * @return the errorCode
     */
    public String getErrorCode() {
        return this.errorCode;
    }

    /**
     * @return the arguments
     */
    public Object[] getArguments() {
        return this.arguments;
    }

    /**
     * @return String
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        return this.errorCode + " { " + Arrays.toString(this.arguments) + " }";
    }

}
